import { NestFactory } from '@nestjs/core';
import { Eureka } from 'eureka-js-client';
import { UsersModule } from './User/Users.module';

async function bootstrap() {
  const app = await NestFactory.create(UsersModule);
  const serverPort = 3001;
  await app.listen(3001);
  const client = new Eureka({
    instance: {
      instanceId: 'lalala',
      app: 'lalala',
      hostName: '192.168.0.179',
      ipAddr: '192.168.0.179',
      statusPageUrl: 'http://192.168.0.179:' + serverPort + '/info',
      healthCheckUrl: 'http://192.168.0.179:' + serverPort + '/health',
      port: { '$': serverPort, '@enabled': 'true' },
      vipAddress: 'lalala',
      dataCenterInfo: { '@class': 'com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo', name: 'MyOwn' },
    }, eureka: { fetchRegistry: false, host: '192.168.0.47', port: 8000, servicePath: '/eureka/apps/' },
  });
  client.logger.level('debug');
  client.start(function(error) {
    console.log(error || 'complete');
  });
}

bootstrap();